programming4us
           
 
 
Applications Server

Microsoft Dynamics AX 2009 : Working with Forms - Modifying the User setup form

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
2/16/2012 3:16:05 PM

The User setup form allows users to customize their most often used forms to fit their needs. Users can hide or move form controls, change labels, and so on. The setup is available for any Dynamics AX form and can be opened from the right-click context menu by selecting the Setup option.

As a developer, I also use this form very often. For example, it contains the very handy System name field, which displays the name of the currently selected table field or method, so you do not need to search in AOT. The Information tab page provides information about the form itself, the caller object, and the menu item used, and it allows opening those objects instantly in AOT view. The last tab page Query shows the tables used in the form's query, which is also very useful to quickly understand the underlying data structure.

In this recipe, we will enhance the User setup form. We will add a new button to the last tab page, which will open the selected table in AOT.

How to do it...

  1. 1. Open SysSetupForm form in AOT, and replace the following code in its fillQueryTreeQueryDatasource():

    formTreeItem = new FormTreeItem(
    nodeText,
    imagelist.image(#ImageDataSource),
    -1,
    null);
  2. with the code:

    formTreeItem = new FormTreeItem(
    nodeText,
    imagelist.image(#ImageDataSource),
    -1,
    queryBuildDataSource.table());
  3. 2. Add a new ButtonGroup to the QueryPage tab page:

    Property Value
    Name ButtonGroup1

    1. 3. Add a new Button to the created button group:

      Property Value
      Name EditTable
      Text Edit
      AutoDeclaration Yes

  1. 4. Override the button's clicked() method:

    void clicked()

    {
    FormTreeItem formTreeItem;
    TableId tableId;
    TreeNode treeNode;
    #AOT
    ;
    formTreeItem = QueryTree.getItem(
    QueryTree.getSelection());
    tableId = formTreeItem.data();
    if (!tableId || !tableid2name(tableId))
    {
    return;
    }
    treeNode = infolog.findNode(
    #TablesPath +
    #AOTDelimiter +
    tableid2name(tableId));
    if (!treeNode)
    {
    return;
    }
    treeNode.AOTnewWindow();
    }



  2. 5. Override selectionChanged() on the QueryTree control:

    public void selectionChanged(
    FormTreeItem _oldItem,
    FormTreeItem _newItem,
    FormTreeSelect _how)

    {;
    super(_oldItem, _newItem, _how);
    EditTable.enabled(
    tableid2name(_newItem.data())?true:false);
    }
  3. 6. To test, open any form, for example, Chart of Account Details from the General ledger, and open User setup by right-clicking anywhere on the form and selecting the Setup option:

  1. 7. Go to the Query tab page, and select one of the tables in the query displayed:

  1. 8. Click the Edit button to open this table in AOT:

How it works...

First, we modify the creation of the query tree control. Normally, each tree node can hold some data. The tree in the SysSetupForm form does not have any data associated with nodes, so we have to modify the code and store the table number in each node representing a table.

Next, we add a new button and override its clicked(). In this method, we get the table number stored in the currently selected node— this is what we stored earlier— and search for that table in AOT. We display it in a new AOT window if found.

Finally, we override selectionChanged() on the QueryTree control to make sure the button's status is updated upon node selection. In other words, the Edit button is enabled if the current tree node contains some data, otherwise it is disabled.

In this way, we have modified the User setup form to provide us with a quick AOT access to the underlying tables.

Other -----------------
- Microsoft Dynamics AX 2009 : Working with Forms - Adding a Go to the Main Table Form link
- Designing and Optimizing Storage in an Exchange Server 2007 Environment (part 4)
- Designing and Optimizing Storage in an Exchange Server 2007 Environment (part 3) - Adding in Fault Tolerance for External Storage Systems
- Designing and Optimizing Storage in an Exchange Server 2007 Environment (part 2) - Designing the Right Data Storage Structure for Exchange Server 2007
- Designing and Optimizing Storage in an Exchange Server 2007 Environment (part 1) - When Is the Right Time to Implement NAS and SAN Devices?
- Engaging the SAP Solution Stack Vendors : General Sizing Best Practices and Approaches
- Engaging the SAP Solution Stack Vendors : Overview—The Sizing and Blueprinting Process
- Microsoft Dynamics AX 2009 : Working with Forms - Building checklists
- Microsoft Dynamics AX 2009 : Working with Forms - Using tree controls
- Active Directory Domain Services 2008 : Transfer the Schema Master Role
- Active Directory Domain Services 2008 : Identify Operations Master Role Holders
- Optimizing an Exchange Server 2007 Environment : Properly Sizing Exchange Server 2007
- Optimizing an Exchange Server 2007 Environment : Analyzing and Monitoring Core Elements
- SharePoint 2010 : Using Data Connection Libraries (part 1) - Connecting to Data Using Alternative Credentials & Configuring the Secure Store Service
- SharePoint 2010 : Using Data Connection Libraries (part 1) - Restricting Data Connection Types & Adding Connections to Data Connection Libraries
- SharePoint 2010 : Excel Services - Using the JavaScript Object Model
- Optimizing Exchange 2007 Servers & Monitoring Exchange Server 2007
- Optimizing an Exchange Server 2007 Environment : Analyzing Capacity and Performance
- Exchange Server 2010 : Planning Certificates for Autodiscover (part 2) - Deploying Exchange Certificates
- Exchange Server 2010 : Planning Certificates for Autodiscover (part 1) - The X.509 Certificate Standard
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us